package com.itheima.demo1;

public class Practice8 {
    public static void main(String[] args) {
        /*
        水仙花:
         一个三位数每位数的3次方加起来等于原数.
         要求每打印两个就换行.
         */
         // 定义一个统计
        int count = 0;
        for (int i = 100; i <= 999; i++) {
            //将这个数拆分出个十百位.
            int ge = i % 10;
            int shi = i / 10 % 10;
            int bai = i / 100;
            int num = ge * ge * ge + shi * shi * shi + bai * bai * bai;

            if (num == i) {
                System.out.print("水仙花数为:" + i + " ");
                //每打印一次计算一次次数.
                count++;
                if (count % 2 == 0) {
                    System.out.println();
                }
            }

        }


    }
}
